package com.yx.springai.mvpserver;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;

import java.util.HashMap;
import java.util.Map;

@Service
public class OpenMeteService {

    public static Map<String,User> map = new HashMap<>();
    public OpenMeteService() {
        map.put("1",new User("1","张三",20,"男"));
        map.put("2",new User("2","李雷",13,"男"));
        map.put("3",new User("3","韩梅梅",14,"女"));
        map.put("4",new User("4","李四",40,"男"));
        map.put("5",new User("5","王五",22,"男"));
    }


    @Tool(description = "根据用户ID查询用户信息")
    public String getUserInfo(String userId){
        User user = map.get(userId);
        if (user == null) {
            return "未找到用户ID为 " + userId + " 的用户信息。可用的用户ID有：" + map.keySet();
        }
        return user.toString();
    }
}
